<?php
namespace Home\Model;
use Think\Model;

//++++++++++++++无限级分类++++++++++++++

class TypeModel extends Model { 
  		 public function getType(){ 
  		 	$list = $this->where('pid = 0')->select();
  		 	foreach ($list as $key => $val) {
  		 		$list[$key]['pid'] = $this->where('pid='.$val['id'])->select();
  		 		 foreach ($list[$key]['pid'] as $key2 => $val2) {
  		 		 	$list[$key]['pid'][$key2]['pid'] = $this->where('pid='.$val2['id'])->select();
            
  		 		 }
  		 	}
  		 	return $list;
  		 }

       public function getHello(){
          $result=$this->where('pid=0')->select();
          foreach ($result as $key => $value){
          //$list = D('hello');
          $map['typeid']=$value['id'];
          $result[$key]['ty'] = $this->table('__HELLO__')->where($map)->select();
      }
        return $result;
       }

       public function getTbshow(){
          $result=$this->where('pid=0')->select();
          foreach ($result as $key => $value){
          //$list = D('hello');
          $map['typeid']=$value['id'];
          $result[$key]['ty'] = $this->table('__TBSHOW__')->where($map)->getField('picname');
      }
          return $result;
       }

      
  }

